
<table>
  <thead>
    <tr>
      <th>Image</th>
      <th>Reward</th>
      <th>Goal in Miles</th>
      <th>Package</th>
      <th></th>
    </tr>
  </thead>

  <tbody>
    <% if @incentives.blank? %>
      <td colspan="4" class="no_results">There are no incentives added yet.</td>
    <% else %>
      <% for incentive in @incentives %>
        <tr class="<%= cycle('odd', 'even') %>">
		<td><%= image_for(incentive, :medium) %></td>
          <td><%= link_to h(incentive.reward), incentive %></td>
          <td><%= h(incentive.goal) %></td>
          <td><%= h(incentive.package.name) %></td>
          <td class="last">
            <%if self.current_user.can('edit:incentives', incentive) %>
              <%= link_to(image_tag('icons/pencil.png', :alt => 'Edit'), edit_incentive_path(incentive)) %>
              <%= link_to(image_tag('icons/cross.png', :alt => 'Delete'), incentive, :confirm => 'Are you sure?', :method => :delete) %>
            <%end%>
          </td>
        </tr>
      <% end %>
    <% end %>
  </tbody>
</table>
<%if self.current_user.can('create:incentives', nil) %>
<p><%= link_to 'Add new incentive', new_incentive_path %></p>
<%end%>